package com.hspedu.poly.polyparameter_;

import javafx.concurrent.Worker;

public class PloyParameter {
    public static void main(String[] args) {
        Manage milan = new Manage("milan",5000,200000);
        worker tom = new worker("tom",2000);

        PloyParameter ployParameter = new PloyParameter();
        ployParameter.showEmpAnnual(milan);
        ployParameter.showEmpAnnual(tom);

        ployParameter.testWork(milan);
        ployParameter.testWork(tom);
    }
    //Employee e = milan;这里是传参的时候用的多态对象
    //如果不用多态对象，那么要调用几个不同对象的getAnnual()，就得在这里写几个方法，并创建其对应的对象形参来接收
    public void showEmpAnnual(Employee e){

        System.out.println(e.getAnnual());
    }

    public void testWork(Employee e){
        if(e instanceof Manage)
            ((Manage) e).manage();
        else if(e instanceof worker)
            ((worker) e ).work();
        else
            System.out.println("不做处理。。。");
//            e.manage();
//            e.work();
    }
}
